<template>
	<view>
		<view class="topbox">
			<view class=""
				style="background-color: #fff;display: flex;border-radius: 40rpx;padding: 15rpx;justify-content: space-between;align-items: center;">
				<input type="text" placeholder="请输入机构名称/手机号" style="margin-left: 20rpx;" v-model="keywords"
					@input="getdata" />
				<image src="../../static/myGroup/suosou.png" mode=""
					style="width: 40rpx;height:40rpx;margin-right: 20rpx;"></image>
			</view>

		</view>

		<view class="" style="display: flex;justify-content: space-between;align-items: center;padding: 30rpx;">
			<view class="lefts">
				机构列表
			</view>
			<view class="" style="display: flex;">
				<view :class="index_nav == 0 ? 'chioces' : ''" @click="up_data(0)" class="kong1">
					待审核诊所
				</view>
				<view :class="index_nav == 1 ? 'chioces' : ''" @click="up_data(1)" class="kong2">
					正常诊所
				</view>
			</view>		
		</view>
		<view class="boxlist" v-for="(item,index) in datalist">
			<view class="" style="font-size: 28rpx;font-weight: bold">
				{{item.name}}
			</view>
			<view class="xtext">
				{{item.addresslist}}
			</view>
			<view class="disf jus xtext">
				<view class="ban">
					机构负责人:{{item.user}}
				</view>
				<view class="ban">
					负责人手机号:{{item.user_phone}}
				</view>
			</view>
			<view class="disf jus xtext">
				<view class="ban">
					所属业务员:{{item.ywy_text}}
				</view>
				<view class="ban">
					装机天数:{{item.zj_day}}天
				</view>
			</view>
			
			<view class="disf jus" style="margin-top: 20rpx;font-weight: bold">
				<view class="" style="display: flex;flex-direction: column;align-items: center">
					<view class="">
						检测金额
					</view>
					<view class="">
						{{item.jc_money}}
					</view>
				</view>
				<view class="" style="display: flex;flex-direction: column;align-items: center">
					<view class="">
						检测项目
					</view>
					<view class="">
						{{item.jc_project}}
					</view>
				</view>
				<view class="" style="display: flex;flex-direction: column;align-items: center">
					<view class="">
						检测订单
					</view>
					<view class="">
						{{item.jc_order}}
					</view>
				</view>
			</view>
			
			<view class="disf jus" style="margin-top: 30rpx;" v-if="clinic_login.clinic_auth == 1">
				<view class="btns" @click="go_url('/pages/device/analysis_list')">
					查看订单
				</view>
				<view class="btns" @click="go_url('/pages/clinic/doctorlist')">
					查看医生列表
				</view>
				<view class="btns" @click="go_url('/pages/clinic/adddoctor')">
					添加医生
				</view>
			</view>
			<view class="disf jus" style="margin-top: 30rpx;" v-if="clinic_login.clinic_auth == 2">
				<!-- <view class="btns" @click="go_url('/pages/device/analysis_list')">
					查看订单
				</view>
				<view class="btns" @click="go_url('/pages/clinic/doctorlist')">
					查看医生列表
				</view>
				<view class="btns" @click="go_url('/pages/clinic/adddoctor')">
					添加医生
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index_nav:1,
				datalist:[],
				keywords:'',
				clinic_login:{}
			}
		},
		onLoad() {
			this.clinic_login = uni.getStorageSync('clinic_userinfo')
			this.getdata()
		},
		methods: {
			go_url(url){
				uni.navigateTo({
					url:url
				})
			},
			getdata(){
				var that = this
				uni.showLoading({
					title: '加载中...'
				})
				uni.request({
					url: this.global.url + 'api/device/clinic_list',
					method: 'POST',
					data: {
						clinic_id: uni.getStorageSync('clinic_id'),
						check_status:that.index_nav,
						keyword:that.keywords
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							// 存用户信息
							that.datalist = result.data
						
						} else {
							uni.showToast({
								title: result.msg,
								icon: 'none'
							})
						}
					},
					complete() {
						uni.hideLoading()
					}
				})
			},
			up_data(index){
				this.index_nav = index
				// 发起请求
				this.getdata()
			}
		}
	}
</script>

<style>
	.topbox {
		padding: 30rpx;
		background-color: #1262DB;
	}
	.lefts{
		padding-left:20rpx;
		border-left: 4px solid #1262DB;
		display: flex;
		align-items: center;
		font-size: 32rpx;
		font-weight: bold;
		letter-spacing: 2px;
	}
	.kong1{
		padding: 10rpx 20rpx;
		border: 1px solid #1262DB;
		
		color: #1262DB;
		border-radius: 10rpx 0rpx 0rpx 10rpx;
		font-size: 20rpx;
	}
	.kong2{
		padding: 10rpx 20rpx;
		border: 1px solid #1262DB;
		
		color: #1262DB;
		border-radius: 0rpx 10rpx 10rpx 0rpx;
		font-size: 20rpx;
	}
	.chioces{
		background-color: #1262DB;
		color: #fff;
		padding: 10rpx 20rpx;
		border: 1px solid #1262DB;
		/* border-radius: 0rpx 10rpx 10rpx 0rpx; */
		font-size: 20rpx;
	}
	.disf{
		display: flex;
	}
	.jus{
		justify-content: space-between;
	}
	.boxlist{
		padding: 40rpx;
		box-shadow: 5px 5px 5px 5px rgb(0, 0, 0,0.1);
		width: 85%;
		margin:0px auto;
	}
	.xtext{
		font-size: 24rpx;
		color: #b3b3b3;
		margin-top: 10rpx;
	}
	.ban{
		width: 50%;
		text-align: left;
	}
	.btns{
		background-color: #1262DB;
		color: #fff;
		padding: 10rpx 20rpx;
		border-radius: 15rpx;
		font-size: 28rpx;
	}
	
</style>